//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ai\fn_groupVehicles.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_npc","_grp","_vehicles"];
DEFAULT_PARAM(_npc,0,objNull);
_vehicles = [];
_grp = grpNull;

if (AND_ALSO(IS_OBJECT(_npc),(!isnull(_npc)))) then {
	_grp = group _npc;
};
if (AND_ALSO(IS_GROUP(_npc),(!isnull(_npc)))) then {
	_grp = _npc;
};

if (!isNull _grp) then {
	{
		if (( vehicle _x != _x || !(_x iskindof "Man")) && !((vehicle _x) in _vehicles)) then {
				 _vehicles = _vehicles + [vehicle _x];
		};
	} foreach units _grp;			
};
TRACE_1("End",_vehicles);
TMFPROFILERSTOP;
_vehicles